package com.hilihili.mq.service.impl;

import com.hilihili.mq.config.VideoTranscodeMqConfig;
import com.hilihili.mq.message.VideoTranscodeMessage;
import com.hilihili.mq.service.RabbitMqService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 视频转码消息队列实现类
 *
 * @author machi
 * @date 2024/01/21
 */
@Service("videoTranscodingMqServiceImpl")
public class VideoTranscodingMqServiceImpl implements RabbitMqService {

    @Autowired
    RabbitTemplate rabbitTemplate;

    @Override
    public void sendMessage(VideoTranscodeMessage videoTranscodeMessage, String routingKey) {
        rabbitTemplate.convertAndSend(VideoTranscodeMqConfig.DIRECT_VIDEO_TRANSCODE_EXCHANGE,routingKey, videoTranscodeMessage);
    }
}


